package com.neusoft.ysu.populationmanagement.controller;


import com.neusoft.ysu.populationmanagement.entity.CommonResult;
import com.neusoft.ysu.populationmanagement.entity.OperationLog;
import com.neusoft.ysu.populationmanagement.entity.Operator;
import com.neusoft.ysu.populationmanagement.entity.Population;
import com.neusoft.ysu.populationmanagement.service.IOperatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author qym
 * @since 2025-06-13
 */
@RestController
@RequestMapping("/operator")
@CrossOrigin
public class OperatorController {

    @Autowired
    private IOperatorService operatorService;

    /**
     * @param username
     * @param password
     * @return Commonresult
     * @description 操作员的登录，包括正常民警，派出所所长，公安局局长
     * @author ym
     * @date 2025-06-16
     */
//    @RequestMapping("login")
//    public CommonResult login( String username, String password) {
//        return operatorService.login(username, password);
//    }

    /**
     * @param operator
     * @return
     * @description 注册警员
     * @author ym
     * @date 2025-06-16
     */

    @RequestMapping("registration")
    public CommonResult registration(Operator operator) {
        return operatorService.registration(operator);
    }

    /**
     * @param operator
     * @return
     * @description 禁用警察
     * @author zyk
     * @date 2025-06-16
     */

    @RequestMapping("disabledOperator")
    public CommonResult disabledOperator(Operator operator){
        return operatorService.deleteOperatorById(operator);
    }
    /**
     * @param operator
     * @return
     * @description 启动警察
     * @author zyk
     * @date 2025-06-16
     */
    @RequestMapping("enableOperator")
    public CommonResult enableOperator(Operator operator){
        return operatorService.enableOperator(operator);
    }

    @RequestMapping("changeLevel")
    public CommonResult changeLevel(Operator operator){return operatorService.changeLevel(operator);}

}
